package com.lei.zjs.web.action;

import java.io.IOException;
import java.util.List;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.lei.zjs.service.ebi.WorkbillService;
import com.lei.zjs.vo.Workbill;
import com.lei.zjs.web.action.base.BaseAction;

/**
 * 工单管理Action
 * @author Spinacia
 *
 */
@Controller
@Scope("prototype")
public class WorkbillAction extends BaseAction<Workbill>{

	@Resource
	private WorkbillService workbillService;
	
	//分页查询工单数据
	public String pageQuery() throws IOException{
		workbillService.pageQuery(pageBean);
		
		String[] excludes = new String[]{"currentPage", "pageSize",
				"detachedCriteria","decidedzones","user","workbills"};
		this.writeJsonObject2String(pageBean, excludes );
		
		return NONE;
	}
	
	//销单
	public String cancel() throws IOException{
		String flag = "1";
		try {
			workbillService.cancel(model);
		} catch (Exception e) {
			e.printStackTrace();
			flag = "0";
		}
		
		HttpServletResponse response = ServletActionContext.getResponse();
		response.setContentType("text/html;charset=utf8");
		response.getWriter().print(flag);
		return NONE;
	}
}
